<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/icon.css"/>">
<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/easyui-lang-zh_CN.js"/>"></script>
<title>蒋路的医生操作病例界面</title>
</head>
<body>
<Style>
		#tableinfo{
			margin-top:5px;
		}
		#tableinfobut{
		 height:28px;
		 width:630px;
	     margin-top:-10px; 
	     margin-left:-10px;
	     padding-left:10px;
	     border-bottom:1px solid #AB82FF;
		}
		#tableinfo{
			margin-top:5px;
			margin-button:5px;
		}
		#moreline,#textline1,#textline2,#textline3{
			float:left;
		}
		#moreline{
			margin-top:10px;
		}
		#textline2{
			margin-left:25px;
		}
		#textline3{
			margin-top:5px;
			margin-left:3px;
		}
		#seecasecancel{
		   margin-left:340px;
		}
	</Style>
	<script type="text/javascript"> 
	
		$(function(){
			
			var date = new Date();		
			var y = date.getFullYear();  
			var m = date.getMonth() + 1;  
			m = m < 10 ? '0' + m : m;  
			var d = date.getDate();  
			d = d < 10 ? ('0' + d) : d;  
			var needDate=y + '-' + m + '-' + d;
			
			$("#seecaseadd").linkbutton({
				onClick:function(){
					$('#seecasewin').window({'title': "病例信息录入"});
					$("#seecasewin").window('open');
					$("#seecaseff").form("clear");
					$("#erOpenTime").textbox("setValue",needDate);
				}
			});
			
			$("#finishDiagnose").linkbutton({
				onClick : function() {
					$("#state").textbox("setValue","结束就诊");
				}
			});
			$("#delayDiagnose").linkbutton({
				onClick : function() {
					$("#state").textbox("setValue","延后就诊");
				}
			});
			
			$("#seecasecancel").linkbutton({
				onClick : function() {
					$('#seecaseff').form("clear");
					$("#seecasewin").window("close");
				}
			});
		
			$("#seecase-save").linkbutton({  
				onClick : function() {
					var text = $('#erId').textbox('getValue');
					$('#seecaseff').form('submit', {
						onSubmit : function() {
						},				
						success : function(data) {
							var json = eval("("+data+")");
							$.messager.alert("温馨提示", json.reason);			
							$("#casetab").datagrid({
							       rowStyler: function (index, row) {
							            if (row.erId== text) {
							                 return 'background-color:#6293BB;color:#fff;';
							            }
							       }
							}); 
							//关闭窗口
							$("#seecasewin").window('close');
							//重新加载数据
							$("#casetab").datagrid("reload");
							$(this).form("clear");
						}
					});
				}
			});
			
			$('#casesearch').searchbox({
			    searcher:function(value,name){
			    	$('#casetab').datagrid('loadData',{total:0,rows:[]});
			    	if(name=="卡号"){
			    		$("#casetab").datagrid({
				    		url:'tocasepage',
				    		queryParams: {
				    			price: value
				    		}
				    	});
			    	}else if(name=="身份证号"){
			    		$.ajax({
		                    type: "Post",
		                    url: "to_findbyid",
		                    data: {idcard:value},
		                    success: function (data) {
		                    	$("#casetab").datagrid({
						    		url:'tocasepage',
						    		queryParams: {
						    			price:data
						    		}
						    	});
		                    }
		                });
			    		
			    	}			    	
			    	
			    }
			});
		});
	</script>
	
	  <table id="casetab" class="easyui-datagrid"
			data-options="
				fitColumns:true,
				fit:true,
				rownumbers: true,
			    url:'',
				border:false ,
				pagination:true,
				toolbar: '#casejl_btn',
				pageSize: 10,
				pageList:[10,20,30,40]
			">
			<thead>           
				    <th class="ident" data-options="field:'erId',width:10,checkbox:true">编号</th>
					<th class="ident" data-options="field:'iName',width:10">姓名</th>
					<th class="ident" data-options="field:'iSex'">性别</th>
					<th class="ident" data-options="field:'iIdentityCard',width:15,editor:'textbox'">身份证号</th>
					<th class="ident" data-options="field:'erOpenTime',width:10,formatter:function(value){
                          var unixTimestamp = new Date(value);  
                          return unixTimestamp.toLocaleDateString();}">就诊日期
                    </th> 					
					<th class="ident" data-options="field:'erPhysician'">挂号医师</th>
					<th class="ident" data-options="field:'inpectionResult'">就诊结果</th>
					<th class="ident" data-options="field:'crCheckDate',width:10,formatter:function(value){
                          var unixTimestamp = new Date(value);  
                          return unixTimestamp.toLocaleDateString();}">检查日期
                    </th>
					<th class="ident" data-options="field:'crFigurePerson',width:15,">检查医师</th>
					<th class="ident" data-options="field:'crCheckResult',width:10,">检查结果</th>
					
				</tr>
			</thead>
		</table>
	
	<div id="casejl_btn">
		<a id="seecaseadd" class="easyui-linkbutton"
			data-options="iconCls:'icon-add',plain:true">添加病例</a> 
		<a id="seecaseup" class="easyui-linkbutton"
			data-options="iconCls:'icon-remove',plain:true">编辑病例</a>
		<input id="casesearch" class="easyui-searchbox" 
			data-options="menu:'#casee',width:220,prompt:'请输入。。。。'">
	</div>
	<div id="casee" style=" width:90px">
		<div date-options="name:'name'">卡号</div>
		<div date-options="name:'name'">身份证号</div>
	</div>
	<div>
		<div id="seecasewin" class="easyui-window"
			style="padding: 10px;line-height: 150%;"
			data-options="
		     width: 654,
		     height:315,
		     closed: true,
		     title:'病例信息操作'
			">		
				<form id="seecaseff" action="addIc" method="post">
						<div id="tableinfobut" style="background-color:#f0f0f0">
							<a id="finishDiagnose" class="easyui-linkbutton"data-options="iconCls:'icon-add',plain:true">结束就诊</a> 
							<a id="delayDiagnose" class="easyui-linkbutton"data-options="iconCls:'icon-add',plain:true">延后就诊</a> 
							<a id="prescribe" class="easyui-linkbutton"data-options="iconCls:'icon-add',plain:true">开药</a> 
							<a id="seecasecancel" class="easyui-linkbutton"data-options="iconCls:'icon-case_cancle',plain:true">取消</a>
						</div>	
						<div id="tableinfo">					
							<table>
									<tr>
										<td>        
											<div class="item">
											    <input id="ierId"  name="ierId"  readonly="true" class="easyui-textbox" data-options="label: 'IC卡号:', width: 200,labelWidth:55">
											</div>
										</td>
										<td>
											<div class="item">
											    <input id="erPhysician"  readonly="true" name="erPhysician" ReadOnly="readonly" class="easyui-textbox" data-options="label: '医师:', width: 200,labelWidth:40">
											</div>
										</td>
										<td>
											<div class="item">
											    <select id="checkNy" class="easyui-combobox"  name="checkNy"  data-options="label: '有无检查:', editable:false,width:200,panelHeight:48,labelWidth:60">
												    <option value="有">有</option>
												    <option value="无">无</option>
												</select>
											</div>
										</td>
									</tr>
									<tr>
										<td>
										    <div class="item">
										     <input id="state"  name="state" class="easyui-textbox" readonly="true" data-options="label: '状&nbsp;&nbsp;态:', width: 200,labelWidth:55">
											</div>
										</td>
										<td>
										   <div class="item">
										   <input id="erOpenTime"   readonly="true" name="erOpenTime" class="easyui-textbox" data-options="label: '日期:',validType: ['Chackiccard'], width: 200,labelWidth:40">									
											</div>
										</td>
									</tr>
							  </table>
						</div>
					
						<div id="moreline">
							    <div id="textline1">
									<input class="easyui-textbox" id="inpectionResult" name="inpectionResult" 
								 	    data-options="label: '诊断结果:',labelWidth:65,multiline:true" 
								 	    style="height:100px;width:300px">
									</input>								
								</div>
								 <div id="textline2">
								 	<input class="easyui-textbox" id="rerId" name="rerId" 
								 	    data-options="label: '处方药:',labelWidth:55,multiline:true" 
								 	    style="height:100px;width:290px">
									</input>
								</div>
								 <div id="textline3">
								 	<input class="easyui-textbox" id="description" name="description" 
								 	    data-options="label: '医&nbsp;&nbsp;&nbsp;嘱:',labelWidth:60,multiline:true" 
								 	    style="height:60px;width:612px">
									</input>
								</div>
						</div>																	  																					
				</form>          			
		</div>
	</div>	
</body>
</html>